package net.teamclerks.rpgf.script.director;

import net.teamclerks.rpgf.avatar.controller.AvatarController;
import net.teamclerks.rpgf.character.controller.CharacterController;
import net.teamclerks.rpgf.inventory.Inventory;
import net.teamclerks.rpgf.scene.Scene;

/**
 * Director handles all scripted events.<br/>
 * The framework treats all events as scripts.<br/>
 * <br/>
 * For this reason, the Director is passed EVERYWHERE.
 * The Director needs to know when a PlayerAvatar moves,
 * needs to know when a CellAction has been fired due to a
 * PlayerAvatar being moved, needs to know when a ChestOpenAction
 * is fired to put an item into an inventory, when an InventoryAdd
 * action is fired, etc.
 * @author msmith
 *
 */
public class Director
{
  /// PRIVATE MEMBER VARIABLES ///
  /**
   * Director has to act as a lone-wolf, or control goes out the
   * window. As such, the Director object is a singleton and can
   * only be instantiated via the <code>getInstance()</code> call.
   */
  private static Director instance = null;
  
  /// CONTROL DATA ///
  /**
   * The Director knows of the avatarController and vise-versa.
   */
  protected AvatarController avatarController;
  /**
   * The Scene that is current queued up.
   */
  protected Scene scene;
  /**
   * The Inventory of the player.
   */
  protected Inventory inventory;
  /**
   * The CharacterController.
   */
  protected CharacterController characterController;
  
  /// DENY CONTRUCTOR ///
  
  /// PUBLIC CONSTRUCTOR ///
  /**
   * Protected constructor to defeat instantiation.
   */
  protected Director(){}
  
  /// PUBLIC METHODS ///
  
  /**
   * Singleton constructor
   */
  public static final Director getInstance()
  {
    if(instance == null)
    {
      instance = new Director();
    }
    
    return instance;
  }
  /**
   * Gets the AvatarController.
   * @return avatarController
   */
  public final AvatarController getAvatarController()
  {
    return this.avatarController;
  }
  /**
   * Sets the AvatarController.
   * @param avatarController
   */
  public final void setAvatarController(AvatarController avatarController)
  {
    this.avatarController = avatarController;
  }
  /**
   * Gets the Scene.
   * @return scene
   */
  public final Scene getScene()
  {
    return this.scene;
  }
  /**
   * Sets the Scene.
   * @param scene
   */
  public final void setScene(Scene scene)
  {
    this.scene = scene;
  }
  /**
   * Gets the Inventory.
   * @return inventory
   */
  public final Inventory getInventory()
  {
    return this.inventory;
  }
  /**
   * Sets the Inventory.
   * @param inventory
   */
  public final void setInventory(Inventory inventory)
  {
    this.inventory = inventory;
  }
  /**
   * Gets the CharacterController.
   * @return characterController
   */
  public final CharacterController getCharacterController()
  {
    return this.characterController;
  }
  /**
   * Sets the CharacterController.
   * @param characterController
   */
  public final void setCharacterController(CharacterController characterController)
  {
    this.characterController = characterController;
  }
}
